import Vue from 'vue';
import uniCrazyRouter, {
	beforeEach,
	afterEach,
	onError,
	afterNotNext
} from "uni-crazy-router";
Vue.use(uniCrazyRouter);

import {
	bindInterceptLogin,
	destroyInterceptLogin
} from './interceptLogin';

// 启用登录页的拦截
bindInterceptLogin();

beforeEach(async (to, from, next) => {
	// 逻辑代码
	// console.log('beforeEach.v2', {to, from, next});

	next();
})

afterEach((to, from) => {
	// 逻辑代码
	// console.log('afterEach.v2', {to, from});
})

onError((to, from) => {
	// console.log('onError.v2', {to, from});
	uni.showModal({
		title: '路由错误',
		content: `${to.url} 不存在`,
		showCancel: false
	});
})
